<template>
<view>
	<view class="header">总业绩:{{count}}</view>
	
	<view class="list_sort">
	    <view @click="selectCate(1)" class="sort_list_top"
	    :class="{ select_true : dataType == 1}">VIp机构</view>
	    <view @click="selectCate(2)" class="sort_list_top"
	    :class="{ select_true : dataType == 2}">非VIP机构</view>
	</view>
	<view class="news">
	    <view class="newslist" v-for="(item,index) in arr" :key="index">
	        <view>机构名称:{{item.name}}</view>
	        <view style="margin-top:20rpx;">总业绩:{{item.total}}</view>
	    </view>
	</view>
</view>
</template>
<script>
import request from '@/util/request.js'
export default {
	data() {
		return{
			count:0,
			list:[],
			dataType:1,//商品
			arr:[]
		}
	},
	onLoad:function(){
		uni.showLoading({
		    title: '加载中'  
		});
		this.getCount();
		this.getlist();
	},
	methods: {
		getCount:function(){
			var that = this
			var data = {'uid':uni.getStorageSync('uid')}
			request({
				url: 'agent/count',
				method: 'get',
				data:data,
				success: (res) => {
					that.count = res.data.data
				}
			})
		},
		getlist:function(){
			var that = this;
			var data = {
				uid:uni.getStorageSync('uid')
			}
			request({
				url: 'agent/moneyList',
				method: 'get',
				data:data,
				success: (res) => {
					uni.hideLoading();
					that.list = res.data.data
					that.arr = res.data.data.no
				}
			})
		},
		selectCate:function(key){
			this.dataType = key
			if(key == 1){
				this.arr = this.list.no
			}
			if(key == 2){
				this.arr = this.list.vip
			}
		}
	}
}
</script>
<style>
.header{
    width:100%;
    height:80rpx;
    line-height: 80rpx;
    background:#00b359;
    color:#fff;
    text-align: center;
}
.list_sort {
    display: flex;
    flex-direction: row;
    width: 100%;
    height:80rpx;
    font-size: 14px;
    border-bottom: 1px solid #f5f5f5;
    color: #333;
    background-color: #fff;
}
.select_true{border-bottom: 3px solid #d65408;}
.sort_list_top{
    width: 49%;
    border-right: 1px solid #ececec;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    height:80rpx;
}
.news {
    width:100%;
    background: #FFF;
    display: flex;
    flex-direction: column;
}
.newslist{
    display:flex;
    flex-direction: column;
    padding:20rpx 20rpx 20rpx 20rpx;
    border-bottom: 1rpx dashed #f5f5f5;
}
</style>